﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharp.Libs.Koc
{
    public class MarchItem
    {
        #region declarations
        #region basic settings
        private int _intCityID = 0;
        private MarchTypes _mtMarchType = MarchTypes.None;
        private int _intKnightID = 0;
        private int _intXCoord = 0;
        private int _intYCoord = 0;
        #endregion

        #region units
        private int _intU1 = 0;
        private int _intU2 = 0;
        private int _intU3 = 0;
        private int _intU4 = 0;
        private int _intU5 = 0;
        private int _intU6 = 0;
        private int _intU7 = 0;
        private int _intU8 = 0;
        private int _intU9 = 0;
        private int _intU10 = 0;
        private int _intU11 = 0;
        private int _intU12 = 0;
        #endregion

        #region ressources
        private int _intR1 = 0;
        private int _intR2 = 0;
        private int _intR3 = 0;
        private int _intR4 = 0;
        private int _intR5 = 0;
        private int _intGold = 0;
        private string _strItems = "";
        #endregion

        #region events
        public delegate void PropertyChangedEventHandler(object sender, PropertyChangedEventArgs pcea);
        public event PropertyChangedEventHandler PropertyChanged;
        public void ThrowPropertyChangedEvent(
            string PropertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(PropertyName));
            }
        }
        #endregion
        #endregion



        #region constructor / finalizer
        public MarchItem()
        {
            
        }
        #endregion



        #region private functions
        /// <summary>checks if the given value is a valid coord or if it exceeds the borders 
        /// given by the MapBorders enum.
        /// </summary>
        /// <param name="Coord">X- or Y- coord</param>
        /// <returns>true if coord lies inside the margin given by the MapBorders enum</returns>
        /// <remarks>since the map is quadratic, there is no need to do a separate check on X- and Y- coords</remarks>
        /// <history>created  15.05.2012</history>
        private bool _IsValidCoord(
            int Coord)
        {
            if (Coord >= MapBorders.MapSizeMin.GetHashCode() && 
                Coord <= MapBorders.MapSizeMax.GetHashCode())
            {
                if (Coord < MapBorders.MapIllegalAreaMin.GetHashCode() &&
                    Coord > MapBorders.MapIllegalAreaMax.GetHashCode())
                {
                    return true;
                }
            }

            return false;
        }
        #endregion
        
        
        
        #region interface
        #region properties
        #region basic settings
        public int CityID
        {
            get { return _intCityID; }
            set { _intCityID = value; ThrowPropertyChangedEvent("CityID"); }
        }

        public MarchTypes MarchType
        {
            get { return _mtMarchType; }
            set { _mtMarchType = value; ThrowPropertyChangedEvent("MarchType"); }
        }

        public int KnightID
        {
            get { return _intKnightID; }
            set { _intKnightID = value; ThrowPropertyChangedEvent("KnightID"); }
        }

        public int XCoord
        {
            get { return _intXCoord; }
            set { _intXCoord = value; ThrowPropertyChangedEvent("XCoord"); }
        }

        public int YCoord
        {
            get { return _intYCoord; }
            set { _intYCoord = value; ThrowPropertyChangedEvent("YCoord"); }
        }
        #endregion

        #region units
        public int U1
        {
            get { return _intU1; }
            set { _intU1 = value; ThrowPropertyChangedEvent("U1"); }
        }

        public int U2
        {
            get { return _intU2; }
            set { _intU2 = value; ThrowPropertyChangedEvent("U2"); }
        }

        public int U3
        {
            get { return _intU3; }
            set { _intU3 = value; ThrowPropertyChangedEvent("U3"); }
        }

        public int U4
        {
            get { return _intU4; }
            set { _intU4 = value; ThrowPropertyChangedEvent("U4"); }
        }

        public int U5
        {
            get { return _intU5; }
            set { _intU5 = value; ThrowPropertyChangedEvent("U5"); }
        }

        public int U6
        {
            get { return _intU6; }
            set { _intU6 = value; ThrowPropertyChangedEvent("U6"); }
        }

        public int U7
        {
            get { return _intU7; }
            set { _intU7 = value; ThrowPropertyChangedEvent("U7"); }
        }

        public int U8
        {
            get { return _intU8; }
            set { _intU8 = value; ThrowPropertyChangedEvent("U8"); }
        }

        public int U9
        {
            get { return _intU9; }
            set { _intU9 = value; ThrowPropertyChangedEvent("U9"); }
        }

        public int U10
        {
            get { return _intU10; }
            set { _intU10 = value; ThrowPropertyChangedEvent("U10"); }
        }

        public int U11
        {
            get { return _intU11; }
            set { _intU11 = value; ThrowPropertyChangedEvent("U11"); }
        }

        public int U12
        {
            get { return _intU12; }
            set { _intU12 = value; ThrowPropertyChangedEvent("U12"); }
        }
        #endregion

        #region ressources
        public int R1
        {
            get { return _intR1; }
            set { _intR1 = value; ThrowPropertyChangedEvent("R1"); }
        }

        public int R2
        {
            get { return _intR2; }
            set { _intR2 = value; ThrowPropertyChangedEvent("R2"); }
        }

        public int R3
        {
            get { return _intR3; }
            set { _intR3 = value; ThrowPropertyChangedEvent("R3"); }
        }

        public int R4
        {
            get { return _intR4; }
            set { _intR4 = value; ThrowPropertyChangedEvent("R4"); }
        }

        public int R5
        {
            get { return _intR5; }
            set { _intR5 = value; ThrowPropertyChangedEvent("R5"); }
        }

        public int Gold
        {
            get { return _intGold; }
            set { _intGold = value; ThrowPropertyChangedEvent("Gold"); }
        }

        public string Items
        {
            get { return _strItems; }
            set { _strItems = value; ThrowPropertyChangedEvent("Items"); }
        }
        #endregion
        #endregion

        #region methods
        #endregion
        #endregion
    }
}
